home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Development Platforms / Apple II / Essentials / rTutors / part3.5 / rTutor.rez < prev    next >
Encoding:
Text File  |  1991-01-16  |  27.2 KB  |  933 lines  |  [TEXT/pdos]

  1. /*---------------------- Top ---------------------------*/
  2. /* RezIIGS source file for LeMaze */
  3.  
  4. /* this gives use access to the "standard" pre-defined resource types */
  5. #include "Types.rez"
  6.  
  7. /*---------------------- Startup Record ---------------------------*/
  8. resource rToolStartup (1)
  9. {
  10.  $C080,       /* set master SCB to mode640 + fFastPortAware + fUseShadowing */
  11.  {
  12.   3,$0000,      /* misc tools */
  13.   4,$0000,      /* quickdraw */
  14.   5,$0000,      /* desk manager */
  15.   6,$0000,      /* eventMgr */
  16.   11,$0000,      /* int math */
  17.   14,$0000,      /* Window Manager */
  18.   15,$0000,      /* Menu Manager */
  19.   16,$0000,      /* Control Manager */
  20.   18,$0000,      /* QD Aux */
  21.   19,$0000,      /* print manager */
  22.   20,$0000,      /* LineEdit tool set */
  23.   21,$0000,      /* Dialog Manager */
  24.   22,$0000,      /* Scrap manager */
  25.   23,$0000,      /* standard file */
  26.   27,$0000,      /* Font manager */
  27.   28,$0000,      /* list manager */
  28.   34,$0000,      /* text edit */
  29.  }
  30. };
  31.  
  32. /*---------------------- Menus & Menu Bars ---------------------------*/
  33.     /* define the resource id of the menu bar itself */
  34. #define    kMenuBarID1       1
  35.  
  36.     /* define all the menu id's */
  37. #define    kAppleMID   1000
  38. #define    kFileMID    2000
  39. #define    kEditMID    3000
  40.  
  41.     /* now, define the menu item id's */
  42. #define    kAboutBoxIID    1001 /* the "About..." box */
  43.     
  44. #define    kNewItem        2001 /* the "New" item */
  45. #define    kOpenItem       2002 /* the "Open..." item */
  46. #define    kCloseItem       255 /* the "Close" item */
  47. #define    kSaveItem       2004 /* the "Save" item */
  48. #define    kSaveAsItem     2005 /* the "Save As..." item */
  49. #define    kQuitItem       2009 /* the "Quit" item */
  50.       
  51. #define    kUndoItem        250 /* the "Undo" item */
  52. #define    kCutItem         251 /* the "Cut" item */
  53. #define    kCopyItem        252 /* the "Copy" item */
  54. #define    kPasteItem       253 /* the "Paste" item */
  55. #define    kClearItem       254 /* the "Clear" item */
  56. #define    kSelectItem     3001 /* the "Select All" item */
  57. #define    kShowClipItem   3002 /* the "Show Clipboard" item */
  58.       
  59.     /* now, define the menu bar */
  60. resource rMenuBar (kMenuBarID1)
  61. {
  62.     {
  63.         kAppleMID,
  64.         kFileMID,
  65.         kEditMID,
  66.     };
  67. };
  68.  
  69.  
  70. /* lay out the Apple menu */
  71. /* this takes several steps: */
  72. /* 1)  define the menu itself in a resource of type "rMenu" */
  73. /* 2)  define the rPString that will be used for the name of the menu */
  74. /* 3)  define the first item in the menu in a resource of type "rMenuItem" */
  75. /* 4)  define the rPString that will be used for the name of the first item */
  76. /* 5)  repeat steps 3 and 4 for all remaining items in that menu */
  77. /* 6)  repeat steps 1 through 5 for all remaining menus */
  78.     
  79. resource rMenu (kAppleMID, nocrossbank)
  80. {
  81.     kAppleMID,    /* ID of the menu this item belongs to */
  82.     0xA008, /* flags => menu title is a resource, items are resources, menu */
  83.             /* is enabled, XOR highlighting, std menu, caching ok */
  84.     kAppleMID,    /* ref to menu's title */
  85.     { kAboutBoxIID }; /* array of items in this menu (only 1 to start with) */
  86. };
  87.  
  88. resource rPString (kAppleMID, nocrossbank)
  89. {
  90.     "@"                    /* this string is the title of the "Apple" menu */
  91. };
  92.  
  93. /* see IIGS Toolbox Reference, Volume 3, menu item template */
  94. resource rMenuItem (kAboutBoxIID, nocrossbank)
  95. {
  96.     kAboutBoxIID, /* item's ID */
  97.     "",           /* no keyboard equivalent */
  98.     "",           /* no keyboard equivalent (allowed 2, this is the 2nd) */
  99.     0,            /* this item does not have a check mark by it */
  100.     0x8040,       /* title is in a resource, enabled (bit 7=0), */
  101.                   /* dividing line below (bit 6=1)  */
  102.     kAboutBoxIID  /* ref of the item's title */
  103. };
  104.  
  105. resource rPString (kAboutBoxIID, nocrossbank)
  106. {
  107.     "About rTutor" /* used as the title for the "About..." item */
  108. };
  109.  
  110.  
  111.     /* lay out the File menu */
  112.     
  113. resource rMenu (kFileMID, nocrossbank)
  114. {
  115.     kFileMID,  /* ID of the menu this item belongs to */
  116.     0xA008,    /* flags => menu title is a resource, items are resources, */
  117.                /* menu is enabled, don't use XOR highlighting, std menu,  */
  118.                /* caching ok */
  119.     kFileMID,  /* ref to menu's title */
  120.     {          /* array of items in this menu */
  121.         kNewItem,
  122.         kOpenItem,
  123.         kCloseItem,
  124.         kSaveItem,
  125.         kSaveAsItem,
  126.         kQuitItem
  127.     };
  128. };
  129.  
  130. resource rPString (kFileMID, nocrossbank)
  131. {
  132.     " File "   /* this string is the title of the "File" menu */
  133. };
  134.  
  135. resource rMenuItem (kNewItem, nocrossbank)
  136. {
  137.     kNewItem,  /* item's ID */
  138.     "N",       /* keyboard equivalent = "N" */
  139.     "n",       /* or = "n" (either key will work) */
  140.     0,         /* this item does not have a check mark by it */
  141.     0x8000,    /* title is in a resource, enabled (bit 7 = 0)  */
  142.     kNewItem   /* ref of the item's title */
  143. };
  144.  
  145. resource rPString (kNewItem, nocrossbank)
  146. {
  147.     "New"      /* this string is used as the title for the "New" item */
  148. };
  149.  
  150. resource rMenuItem (kOpenItem, nocrossbank)
  151. {
  152.     kOpenItem,
  153.     "O",       /* that's an "OH" on this line, not a "zero" */
  154.     "o",       /* that's an "OH" on this line, not a "zero" */
  155.     0,         /* this one's a "zero" */
  156.     0x8040,    /* the "4" means put a dividing line under this item */
  157.     kOpenItem
  158. };
  159.  
  160. resource rPString (kOpenItem, nocrossbank)
  161. {
  162.     "Open..."
  163. };
  164.  
  165. resource rMenuItem (kCloseItem, nocrossbank)
  166. {
  167.     kCloseItem,
  168.     "W",
  169.     "w",
  170.     0,
  171.     0x8000,
  172.     kCloseItem
  173. };
  174.  
  175. resource rPString (kCloseItem, nocrossbank)
  176. {
  177.     "Close"
  178. };
  179.  
  180. resource rMenuItem (kSaveItem, nocrossbank)
  181. {
  182.     kSaveItem,
  183.     "S",
  184.     "s",
  185.     0,
  186.     0x8000,
  187.     kSaveItem
  188. };
  189.  
  190. resource rPString (kSaveItem, nocrossbank)
  191. {
  192.     "Save"
  193. };
  194.  
  195. resource rMenuItem (kSaveAsItem, nocrossbank)
  196. {
  197.     kSaveAsItem,
  198.     "",        /* no key equivalents for this item */
  199.     "",
  200.     0,
  201.     0x8000,
  202.     kSaveAsItem    
  203. };
  204.  
  205. resource rPString (kSaveAsItem, nocrossbank)
  206. {
  207.     "Save As..."
  208. };
  209.  
  210. resource rMenuItem (kQuitItem, nocrossbank)
  211. {
  212.     kQuitItem,
  213.     "Q",
  214.     "q",
  215.     0,
  216.     0x8000,
  217.     kQuitItem    
  218. };
  219.  
  220. resource rPString (kQuitItem, nocrossbank)
  221. {
  222.     "Quit"
  223. };
  224.  
  225.  
  226.     /* lay out the Edit menu */
  227.     
  228. resource rMenu (kEditMID, nocrossbank)
  229. {
  230.     kEditMID,    /* ID of the menu this item belongs to */
  231.     0xA008,
  232.     kEditMID,    /* ref to menu's title */
  233.     {            /* array of items in this menu */
  234.         kUndoItem,
  235.         kCutItem,
  236.         kCopyItem,
  237.         kPasteItem,
  238.         kClearItem,
  239.         kSelectItem,
  240.         kShowClipItem
  241.     };
  242. };
  243.  
  244. resource rPString (kEditMID, nocrossbank)
  245. {
  246.     " Edit "   /* this string is the title of the "Edit" menu */
  247. };
  248.  
  249. resource rMenuItem (kUndoItem, nocrossbank)
  250. {
  251.     kUndoItem,
  252.     "Z",
  253.     "z",
  254.     0,
  255.     0x8040,
  256.     kUndoItem
  257. };
  258.  
  259. resource rPString (kUndoItem, nocrossbank)
  260. {
  261.     "Undo"
  262. };
  263.  
  264. resource rMenuItem (kCutItem, nocrossbank)
  265. {
  266.     kCutItem,
  267.     "X",
  268.     "x",
  269.     0,
  270.     0x8000,
  271.     kCutItem
  272. };
  273.  
  274. resource rPString (kCutItem, nocrossbank)
  275. {
  276.     "Cut"
  277. };
  278.  
  279. resource rMenuItem (kCopyItem, nocrossbank)
  280. {
  281.     kCopyItem,
  282.     "C",
  283.     "c",
  284.     0,
  285.     0x8000,
  286.     kCopyItem
  287. };
  288.  
  289. resource rPString (kCopyItem, nocrossbank)
  290. {
  291.     "Copy"
  292. };
  293.  
  294. resource rMenuItem (kPasteItem, nocrossbank)
  295. {
  296.     kPasteItem,
  297.     "V",
  298.     "v",
  299.     0,
  300.     0x8000,
  301.     kPasteItem
  302. };
  303.  
  304. resource rPString (kPasteItem, nocrossbank)
  305. {
  306.     "Paste"
  307. };
  308.  
  309. resource rMenuItem (kClearItem, nocrossbank)
  310. {
  311.     kClearItem,
  312.     "",
  313.     "",
  314.     0,
  315.     0x8000,
  316.     kClearItem
  317. };
  318.  
  319. resource rPString (kClearItem, nocrossbank)
  320. {
  321.     "Clear"
  322. };
  323.  
  324. resource rMenuItem (kSelectItem, nocrossbank)
  325. {
  326.     kSelectItem,
  327.     "A",
  328.     "a",
  329.     0,
  330.     0x8040,  /* the "4" means this one has a divider under it */
  331.     kSelectItem
  332. };
  333.  
  334. resource rPString (kSelectItem, nocrossbank)
  335. {
  336.     "Select All"
  337. };
  338.  
  339. resource rMenuItem (kShowClipItem, nocrossbank)
  340. {
  341.     kShowClipItem,
  342.     "",
  343.     "",
  344.     0,
  345.     0x8000,
  346.     kShowClipItem
  347. };
  348.  
  349. resource rPString (kShowClipItem, nocrossbank)
  350. {
  351.     "Show Clipboard"
  352. };
  353.  
  354.  
  355. /*---------------------- Windows --------------------------*/
  356.     /* define the resource ID's for all windows used by this app */
  357. #define myWindowID    2362  /* window's resource ID = 2362 */
  358.  
  359. /* First, we lay out the window itself */
  360. resource rWindParam1 (myWindowID) 
  361. {
  362.  fTitle+fMove+fVis, /* has a title, can be moved, and it is visible */
  363.  myWindowID,        /* resource ID of the title */
  364.  0,                 /* no ref Con needed */
  365.  {0,0,0,0},         /* no zoom box, so we don't care about the zoom rect */
  366.  0,                 /* use std color table for now */
  367.  {0,0},             /* upper left corner of vis rgn = upper left of document */
  368.  {0,0},             /* we don't really have a "document" for this window, so */
  369.                     /* set the data size to zero */
  370.  {0,0},             /* maximum height and width */
  371.  {0,0},             /* don't scroll vertically or horizontally */
  372.  {0,0},             /* no "document", so page size is zero also */
  373.  0,                 /* passed to info bar draw routine - not used here */
  374.  0,                 /* height of info bar - not used here */
  375.  {28,2,196,638},    /* this rect defines the boundaries of the window */
  376.  infront,           /* window comes up in front of other windows */
  377.  0,                 /* set to NIL to avoid bug in NewWindow2 */
  378.  refIsResource*0x0100+resourceToResource /* title string and */
  379.                                          /* control list are resources */
  380. };
  381.  
  382. /* define the title string used by our window */
  383. resource rPstring (myWindowID)
  384. {
  385.     " Level 1 "
  386. };
  387.  
  388.  
  389.  
  390. /*--------- Alert Window - used as our About Box --------------------*/
  391.  
  392. #define kAboutStr   100 /* define the constant for the About box's string */
  393.  
  394. resource rAlertString (kAboutStr) 
  395. {
  396.  "\$30"                 /* we're using a custom sized box */
  397.  "\$1E\$00"             /* top coord (v1) for custom sized box */
  398.  "\$AA\$00"             /* left coord (h1) for custom sized box */
  399.  "\$B0\$00"             /* bottom coord (v2) for custom sized box */
  400.  "\$D6\$01"             /* right coord for (h2) custom sized box */
  401.  "\$30"                 /* no icon in the window */
  402.  "/"                    /* seperator character */
  403.  TBEndOfLine            /* stick an extra blank line in there */
  404.  TBEndOfLine            /* stick an extra blank line in there */
  405.  TBCenterJust           /* center the text */
  406.  TBStyleBold            /* turn on bold face */
  407.  "rTutor.S16"           /* the first line of text */
  408.  TBEndOfLine            /* mark the end of the line */
  409.  TBEndOfLine            /* stick an extra blank line in there */
  410.  TBStylePlain           /* turn off bold face */
  411.  "The resource tutorial application"    /* the next line of text */
  412.  TBEndOfLine            /* mark the end of the line */
  413.  TBEndOfLine            /* stick an extra blank line in there */
  414.  TBStylePlain           /* turn off italics */
  415.  TBForeColor            /* set foreground color to... */
  416.  TBColor0               /* ...black */
  417.  "written by:"          /* another line of text */
  418.  TBEndOfLine            /* mark the end of the line */
  419.  TBEndOfLine            /* stick an extra blank line in there */
  420.  TBForeColor            /* set foreground color to... */
  421.  TBColor1               /* ...red */
  422.  "Tim Swihart"          /* the name of this app's author */
  423.  TBEndOfLine            /* mark the end of the line */
  424.  TBEndOfLine            /* stick an extra blank line in there */
  425.  TBEndOfLine            /* stick an extra blank line in there */
  426.  TBStylePlain           /* turn off bold face */
  427.  TBForeColor            /* set foreground color to... */
  428.  TBColor0               /* ...black */
  429.  "Version 3.5"          /* last line of text */
  430.  "/"                    /* "/" is our seperator character */
  431.  "^Thanks, Tim!"     /* "^" means make the button the "default" (tie it to */
  432.                /* the RETURN key) - make the button's text be "Thanks, Tim!" */
  433.  "\$00"        /* make sure the string is NULL terminated since we told */
  434.                /* the window manager we would be using a C string */
  435. };
  436.  
  437.  
  438. /*---------------------- Icons ---------------------------*/
  439. #define kFloorIcon  1   /* for the floor tiles */
  440. #define kPoleIcon   2   /* for the up/down pole */
  441. #define kCoinIcon   3   /* gold coin */
  442. #define kGemIcon    4   /* diamond  */
  443. #define kRockIcon   5   /* rock */
  444. #define kLeftIcon   6   /* man facing left */
  445. #define kRightIcon  7   /* man facing right */
  446. #define kCenterIcon 8   /* man facing forward */
  447. #define kLeft2Icon  9   /* icon for halfway between positions moving left */
  448. #define kRight2Icon 10  /* icon for halfway between positions moving right */
  449. #define kSplatIcon  11  /* icon for player that fell too far */
  450. #define kEraserIcon 255 /* solid white icon for erasing other icons */
  451.  
  452.  
  453. resource rIcon (kFloorIcon, purgeable1, nocrossbank)
  454. {
  455.         0x8000,        /* bit 15 = 1, so it's a color icon */
  456.         8,             /* height = 8 pixels */
  457.         8,             /* width = 8 pixels */
  458.         $"555555FF"    /* array of pixels in the icon's image */
  459.         $"5EEEE5FF" 
  460.         $"85EE58FF"
  461.         $"A8558AFF" 
  462.         $"A8558AFF"
  463.         $"85EE58FF"
  464.         $"5EEEE5FF"
  465.         $"555555FF", 
  466.         
  467.         $"FFFFFF00"    /* array of pixels in the icon's image */
  468.         $"FFFFFF00" 
  469.         $"FFFFFF00" 
  470.         $"FFFFFF00" 
  471.         $"FFFFFF00"
  472.         $"FFFFFF00"
  473.         $"FFFFFF00"
  474.         $"FFFFFF00";
  475. };
  476.  
  477.  
  478. resource rIcon (kPoleIcon, purgeable1, nocrossbank)
  479. {
  480.     0x8000,             /* bit 15 = 1, so it's a color icon */
  481.     8,                  /* height = 8 pixels */
  482.     8,                  /* width = 8 pixels */
  483.     $"FF55FFFF"         /* array of pixels in the icon's image */
  484.     $"FF55FFFF" 
  485.     $"FF55FFFF"
  486.     $"FF55FFFF" 
  487.     $"FF55FFFF"
  488.     $"FF55FFFF"
  489.     $"FF55FFFF"
  490.     $"FF55FFFF", 
  491.     
  492.     $"FFFFFF00"         /* array of pixels in the icon's image */
  493.     $"FFFFFF00" 
  494.     $"FFFFFF00" 
  495.     $"FFFFFF00" 
  496.     $"FFFFFF00"
  497.     $"FFFFFF00"
  498.     $"FFFFFF00"
  499.     $"FFFFFF00";
  500. };
  501.  
  502.  
  503. resource rIcon (kCoinIcon, purgeable1, nocrossbank)
  504. {
  505.     0x8000,             /* bit 15 = 1, so it's a color icon */
  506.     8,                  /* height = 8 pixels */
  507.     8,                  /* width = 8 pixels */
  508.     $"FFFFFFFF"         /* array of pixels in the icon's image */
  509.     $"FFFFFFFF" 
  510.     $"FFFFFFFF"
  511.     $"FFFFFFFF" 
  512.     $"FFFFFFFF"
  513.     $"FFF6FFFF"
  514.     $"FF666FFF"
  515.     $"FFF6FFFF", 
  516.     
  517.     $"FFFFFF00"         /* array of pixels in the icon's image */
  518.     $"FFFFFF00" 
  519.     $"FFFFFF00" 
  520.     $"FFFFFF00" 
  521.     $"FFFFFF00"
  522.     $"FFFFFF00"
  523.     $"FFFFFF00"
  524.     $"FFFFFF00";
  525. };
  526.  
  527.  
  528. resource rIcon (kGemIcon, purgeable1, nocrossbank)
  529. {
  530.     0x8000,             /* bit 15 = 1, so it's a color icon */
  531.     8,                  /* height = 8 pixels */
  532.     8,                  /* width = 8 pixels */
  533.     $"FFFFFFFF"         /* array of pixels in the icon's image */
  534.     $"FFFFFFFF" 
  535.     $"FFFFFFFF"
  536.     $"FFFFFFFF" 
  537.     $"FFDDDFFF"
  538.     $"FDEEEDFF"
  539.     $"FFDEDFFF"
  540.     $"FFFDFFFF", 
  541.     
  542.     $"FFFFFF00"         /* array of pixels in the icon's image */
  543.     $"FFFFFF00" 
  544.     $"FFFFFF00" 
  545.     $"FFFFFF00" 
  546.     $"FFFFFF00"
  547.     $"FFFFFF00"
  548.     $"FFFFFF00"
  549.     $"FFFFFF00";
  550. };
  551.  
  552.  
  553. resource rIcon (kRockIcon, purgeable1, nocrossbank)
  554. {
  555.     0x8000,             /* bit 15 = 1, so it's a color icon */
  556.     8,                  /* height = 8 pixels */
  557.     8,                  /* width = 8 pixels */
  558.     $"FFFFFFFF"         /* array of pixels in the icon's image */
  559.     $"FFFFFFFF" 
  560.     $"FFFFFFFF"
  561.     $"FFFFFFFF" 
  562.     $"FFF00FFF"
  563.     $"FF0000FF"
  564.     $"FF0000FF"
  565.     $"FFF00FFF", 
  566.     
  567.     $"FFFFFF00"         /* array of pixels in the icon's image */
  568.     $"FFFFFF00" 
  569.     $"FFFFFF00" 
  570.     $"FFFFFF00" 
  571.     $"FFFFFF00"
  572.     $"FFFFFF00"
  573.     $"FFFFFF00"
  574.     $"FFFFFF00";
  575. };
  576.  
  577.  
  578. resource rIcon (kLeftIcon, purgeable1, nocrossbank)
  579. {
  580.     0x8000,             /* bit 15 = 1, so it's a color icon */
  581.     8,                  /* height = 8 pixels */
  582.     8,                  /* width = 8 pixels */
  583.     $"FFF0FFFF"         /* array of pixels in the icon's image */
  584.     $"FF0A0FFF" 
  585.     $"FFF00FFF"
  586.     $"FFFF0FFF" 
  587.     $"FF000FFF"
  588.     $"FFFF0FFF" 
  589.     $"FFF0F0FF" 
  590.     $"F00F00FF", 
  591.     
  592.     $"00FFF000"         /* array of pixels in the icon's image */
  593.     $"0FFFFF00" 
  594.     $"0FFFFF00" 
  595.     $"0FFFFF00" 
  596.     $"0FFFFF00"
  597.     $"0FFFFF00" 
  598.     $"0FFFFF00" 
  599.     $"FFFFFF00";
  600. };
  601.  
  602.  
  603. resource rIcon (kRightIcon, purgeable1, nocrossbank)
  604. {
  605.     0x8000,             /* bit 15 = 1, so it's a color icon */
  606.     8,                  /* height = 8 pixels */
  607.     8,                  /* width = 8 pixels */
  608.     $"FFF0FFFF"         /* array of pixels in the icon's image */
  609.     $"FF0A0FFF" 
  610.     $"FF00FFFF"
  611.     $"FF0FFFFF" 
  612.     $"FF000FFF"
  613.     $"FF0FFFFF" 
  614.     $"F0F0FFFF" 
  615.     $"F00F00FF", 
  616.  
  617.     $"00FFF000"         /* array of pixels in the icon's image */
  618.     $"0FFFFF00" 
  619.     $"0FFFFF00" 
  620.     $"0FFFFF00" 
  621.     $"0FFFFF00"
  622.     $"0FFFFF00" 
  623.     $"FFFFFF00" 
  624.     $"FFFFFF00";
  625. };
  626.  
  627. resource rIcon (kCenterIcon, purgeable1, nocrossbank)
  628. {
  629.     0x8000,             /* bit 15 = 1, so it's a color icon */
  630.     8,                  /* height = 8 pixels */
  631.     8,                  /* width = 8 pixels */
  632.     $"FFF0FFFF"         /* array of pixels in the icon's image */
  633.     $"FF0A0FFF" 
  634.     $"FFF0FFFF"
  635.     $"FFF0FFFF" 
  636.     $"F00000FF"
  637.     $"FFF0FFFF"
  638.     $"FF0F0FFF"
  639.     $"F00F00FF", 
  640.     
  641.     $"00FFF000"         /* array of pixels in the icon's image */
  642.     $"0FFFFF00" 
  643.     $"00FFF000" 
  644.     $"00FFF000" 
  645.     $"FFFFFF00"
  646.     $"00FFF000"
  647.     $"0FFFFF00"
  648.     $"FFFFFF00";
  649. };
  650.  
  651. resource rIcon (kLeft2Icon, purgeable1, nocrossbank)
  652. {
  653.     0x8000,             /* bit 15 = 1, so it's a color icon */
  654.     8,                  /* height = 8 pixels */
  655.     8,                  /* width = 8 pixels */
  656.     $"FFF0FFFF"         /* array of pixels in the icon's image */
  657.     $"FF0A0FFF" 
  658.     $"FFF00FFF"
  659.     $"FFFF0FFF" 
  660.     $"FFF00FFF"
  661.     $"FFFF0FFF"
  662.     $"FFFF0FFF"
  663.     $"FFF00FFF", 
  664.     
  665.     $"00FFF000"         /* array of pixels in the icon's image */
  666.     $"0FFFFF00" 
  667.     $"00FFFF00" 
  668.     $"00FFFF00" 
  669.     $"00FFFF00"
  670.     $"00FFFF00"
  671.     $"00FFFF00"
  672.     $"00FFFF00";
  673. };
  674.  
  675. resource rIcon (kRight2Icon, purgeable1, nocrossbank)
  676. {
  677.     0x8000,             /* bit 15 = 1, so it's a color icon */
  678.     8,                  /* height = 8 pixels */
  679.     8,                  /* width = 8 pixels */
  680.     $"FFF0FFFF"         /* array of pixels in the icon's image */
  681.     $"FF0A0FFF" 
  682.     $"FF00FFFF"
  683.     $"FF0FFFFF" 
  684.     $"FF00FFFF"
  685.     $"FF0FFFFF"
  686.     $"FF0FFFFF"
  687.     $"FF00FFFF", 
  688.     
  689.     $"00FFF000"         /* array of pixels in the icon's image */
  690.     $"0FFFFF00" 
  691.     $"0FFFF000" 
  692.     $"0FFF0000" 
  693.     $"0FFFF000"
  694.     $"0FFF0000"
  695.     $"0FFF0000"
  696.     $"0FFFF000";
  697. };
  698.  
  699. resource rIcon (kSplatIcon, purgeable1, nocrossbank)
  700. {
  701.     0x8000,             /* bit 15 = 1, so it's a color icon */
  702.     8,                  /* height = 8 pixels */
  703.     8,                  /* width = 8 pixels */
  704.     $"FFFFFFFF"         /* array of pixels in the icon's image */
  705.     $"FFFFFFFF" 
  706.     $"FFFFFFFF"
  707.     $"FFFFFFFF" 
  708.     $"FFF0FFFF"
  709.     $"FF0A0FFF"
  710.     $"F0F0F0FF"
  711.     $"FF000FFF", 
  712.     
  713.     $"FFFFFF00"         /* array of pixels in the icon's image */
  714.     $"FFFFFF00" 
  715.     $"FFFFFF00" 
  716.     $"FFFFFF00" 
  717.     $"FFFFFF00"
  718.     $"FFFFFF00"
  719.     $"FFFFFF00"
  720.     $"FFFFFF00";
  721. };
  722.  
  723. /* set the preload bit to be sure it's waiting for us in RAM */
  724. resource rIcon (kEraserIcon, purgeable1, nocrossbank, preload)
  725. {
  726.     0x8000,             /* bit 15 = 1, so it's a color icon */
  727.     8,                  /* height = 8 pixels */
  728.     8,                  /* width = 8 pixels */
  729.     $"FFFFFFFF"         /* array of pixels in the icon's image */
  730.     $"FFFFFFFF" 
  731.     $"FFFFFFFF"
  732.     $"FFFFFFFF" 
  733.     $"FFFFFFFF"
  734.     $"FFFFFFFF"
  735.     $"FFFFFFFF"
  736.     $"FFFFFFFF", 
  737.     
  738.     $"FFFFFF00"         /* array of pixels in the icon's image */
  739.     $"FFFFFF00" 
  740.     $"FFFFFF00" 
  741.     $"FFFFFF00" 
  742.     $"FFFFFF00"
  743.     $"FFFFFF00"
  744.     $"FFFFFF00"
  745.     $"FFFFFF00";
  746. };
  747.  
  748.  
  749. /*---------------------- SpotLists ---------------------------*/
  750. /* This is a new type of resource, so I'll have to define its template */
  751. /* before I can use it.  We'll use it to save space on the "levels" in */
  752. /* this game -> rather than just manually call DrawIcon() a zillion times, */
  753. /* we'll create a custom data structure (represented by this resource */
  754. /* template) that contains the pixel coordinates of each icon we want to */
  755. /* draw as as well as each icon's "grid" location (superimpose a grid on */
  756. /* the screen & each icon fit into one grid square).  We use the "grid" to */
  757. /* make it easier to make our player "move" (we'll get into HOW it moves */
  758. /* next time).  If you're lost, then see the detailed docs that came with */
  759. /* this release. */
  760.  
  761. /* The structure is fairly simple - it's just a list of "spots" (a "spot" */
  762. /* is a POINT and two integers - the POINT is where we want the upper left */
  763. /* corner of an icon to be drawn, the integers represent which "row" and */
  764. /* "column" is being filled by an icon).  We need to know how many spots */
  765. /* are in the list, so we let Rez count them for us by taking advantage of */
  766. /* the "$$Countof" dirrective for Rez (see the manual for more details).  */
  767. /* To add an icon to the screen, we simply put its spot info in the list */
  768. /* and recompile (you may want to break these lists into separate files and */
  769. /* use the -a option on the command line until you have the screen set up */
  770. /* the way you like it). */
  771.  
  772. // simple list of points of icon locations and their array locations
  773. #define rMySpotList $6003
  774.                                 
  775. type rMySpotList
  776. {
  777.     integer=$$Countof(myIconSpots);
  778.     array myIconSpots
  779.     {
  780.         point;       /* upper left corner of the icon in local coords */
  781.         integer;     /* row this icon is in (0 to 20) */
  782.         integer;     /* column this icon is in (0 to 52) */
  783.     };
  784. };
  785.  
  786.  
  787. /* Now we're ready to start using this custom resource template. */
  788. /* Since we know we'll want more than one "level" in our game, we need */
  789. /* a way to tell each level apart.  Since the resource ID can be anything */
  790. /* we want it to be, why not use it?  If we treat the resource ID as a hex */
  791. /* number, then we see it has 8 'digits' -> let's leave the first two zero, */
  792. /* the next two will be the ID of the icon that list is for, and the last */
  793. /* four will be the level this list is for.  That lets us have 255 icons */
  794. /* and 65535 levels.  If we need more icons some day, we can change this. */
  795. /* We calculate each resource ID by shifting the icon ID left four times */
  796. /* (multiplying by $10000 does the shift) and then adding the level number. */
  797. /* If you're lost, look at the ID in hex and think about how to get the */
  798. /* pieces where they belong.  You'll see that it look like:  */
  799. /* ID = $00xxyyyy where $xx = icon ID (0-255) and $yyyy = level (0-65535) */
  800.  
  801.  
  802. #define kL1 1   /* constant used for "level 1" */
  803.  
  804. /* In order to "protect" our investment in all of the work it takes to lay */
  805. /* out a "spot list", we'll use a couple of constants to automate the */
  806. /* calculation of the pixel positions based on the desired row and column.  */
  807. /* We just multiply the row number by the height of an icon to get the */
  808. /* desired row and we multiply the column number by the width of an icon to */
  809. /* get the desired column.  If we make the icon taller, shorter, wider, or */
  810. /* thinner, we can simply adjust the two constants and all of the points */
  811. /* will automatically be taken care of when we recompile!  Of course, */
  812. /* changing the size of the icons means a different number of them will fit */
  813. /* on the screen, so add or remove entries in the spot list to account for */
  814. /* this -> it will still be MUCH faster (and less prone to error) than */
  815. /* hard-coding all those pixel positions. */
  816.  
  817. #define kIconHeight  8   /* used to calculate correct row */
  818. #define kIconWidth  12   /* used to calculate correct column */
  819.  
  820. /* The array of where the floor icons are... */
  821. resource rMySpotList (kFloorIcon*0x00010000+kL1, purgeable1, nocrossbank)  
  822. {
  823.   {
  824.     {3*kIconHeight, 4*kIconWidth},   3,  4,  /* v=24, h=48, row=3, column=8 */
  825.     {3*kIconHeight, 5*kIconWidth},   3,  5,  /* (v=row*hieght) */
  826.     {3*kIconHeight, 6*kIconWidth},   3,  6,  /* (h=column*width) */
  827.     {3*kIconHeight, 7*kIconWidth},   3,  7,
  828.     {3*kIconHeight, 8*kIconWidth},   3,  8,
  829.     {3*kIconHeight, 9*kIconWidth},   3,  9,
  830.     {8*kIconHeight, 4*kIconWidth},   8,  4,
  831.     {8*kIconHeight, 5*kIconWidth},   8,  5,
  832.     {8*kIconHeight, 6*kIconWidth},   8,  6,
  833.     {8*kIconHeight, 7*kIconWidth},   8,  7,
  834.     {8*kIconHeight, 8*kIconWidth},   8,  8,
  835.     {8*kIconHeight, 9*kIconWidth},   8,  9,
  836.     {20*kIconHeight, 9*kIconWidth}, 20,  9,  /* all the way at the bottom */
  837.     {19*kIconHeight, 8*kIconWidth}, 19,  8,  /* one up from the bottom */
  838.     {8*kIconHeight, 52*kIconWidth},  8, 52,  /* all the way to the right */
  839.     {7*kIconHeight, 51*kIconWidth},  7, 51,  /* one back from the right */
  840.     {0*kIconHeight, 8*kIconWidth},   0,  8,  /* at the very top */
  841.     {1*kIconHeight, 7*kIconWidth},   1,  7,  /* one down from the top */
  842.     {1*kIconHeight, 0*kIconWidth},   1,  0,  /* all the way to the left */
  843.     {2*kIconHeight, 1*kIconWidth},   2,  1   /* one down from the top */
  844.     };
  845. };
  846.  
  847.  
  848. /* This next list has its pixel positions hard coded.  Make the icons */
  849. /* taller, then adjust the spot list for both the "floor" and "pole" icons. */
  850. /* Which is easier to adjust?  Sometimes, more work up front makes it MUCH */
  851. /* easier to make changes later! */
  852.  
  853. /* make the array of poles within the playfield */
  854. resource rMySpotList (kPoleIcon*0x00010000+kL1, purgeable1, nocrossbank)
  855. {
  856.     {
  857.         {  0, 60},  0, 5,
  858.         {  8, 60},  1, 5,
  859.         { 16, 60},  2, 5,
  860.         { 24, 60},  3, 5,
  861.         { 32, 60},  4, 5,
  862.         { 40, 60},  5, 5,
  863.         { 48, 60},  6, 5,
  864.         { 56, 60},  7, 5,
  865.         { 64, 60},  8, 5,
  866.         { 72, 60},  9, 5,
  867.         { 80, 60}, 10, 5,
  868.         { 88, 60}, 11, 5,
  869.         { 96, 60}, 12, 5,
  870.         {104, 60}, 13, 5,
  871.         {112, 60}, 14, 5,
  872.         {112, 84}, 14, 7,
  873.         {112,108}, 14, 9,
  874.         {120, 60}, 15, 5,
  875.         {120, 84}, 15, 7,
  876.         {120,108}, 15, 9,
  877.         {128, 60}, 16, 5,
  878.         {136, 60}, 17, 5,
  879.         {144, 60}, 18, 5,
  880.         {152, 60}, 19, 5,
  881.         {160, 60}, 20, 5
  882.     };
  883. };
  884.  
  885.  
  886. /* place the player - always do this one last!*/
  887. resource rMySpotList (kLeftIcon*0x00010000+kL1, purgeable1, nocrossbank)
  888. {
  889.     {
  890.         {7*kIconHeight, 5*kIconWidth}, 7, 5
  891.     };
  892. };
  893.  
  894.  
  895.  
  896. /*---------------------- whichIconsUsed ---------------------------*/
  897. /* This is a new type of resource, so I'll have to define its template */
  898. /* before I can use it.  It's just another custom "list" -> this one keeps */
  899. /* track of which icons we're using on this level (it also counts how many */
  900. /* icons are used per level).  This way, we can add new types of icons (or */
  901. /* remove existing ones) by simply creating a "spotlist" for them and */
  902. /* putting their ID in the "whichIconsUsed" list -> no Changes to the app's */
  903. /* source code is needed (unless you want to assign new, specific behavior */
  904. /* to those icons).  We only have to track usage by level number, so the */
  905. /* resource ID is simply the level the list represents -> i.e.:  resource */
  906. /* ID = 1 means level 1, etc. */
  907.  
  908. // simple list of which icons are used on this level
  909. #define rWhichIconsUsed     $6002
  910.                                 
  911. type rWhichIconsUsed      // resource ID = game level
  912. {
  913.     integer=$$Countof(whichIcons);
  914.     array whichIcons
  915.     {
  916.         integer;          /* resource ID of the icons used on this level */
  917.     };
  918. };
  919.  
  920. /* create the list for level 1 */
  921. resource rWhichIconsUsed (kL1, purgeable1, nocrossbank)
  922. {
  923.     {
  924.         kFloorIcon,
  925.         kPoleIcon,
  926.         kLeftIcon   /* the player must be last in the list! */
  927.     };
  928. };
  929.  
  930.  
  931.  
  932. /*---------------------- Bottom ---------------------------*/
  933.